import React, { useEffect, useState } from 'react'
import { useDispatch, useSelector } from "react-redux"
import { ALLSTATE, GETLIST } from "../../../types/store.d"
import { Tabs, NavBar, Search, Sidebar, Image, ProductCard, Tag, Grid } from 'react-vant';

function Index() {
  const bookArr = useSelector((state: ALLSTATE) => {
    return state.bookArr
  })
  return (
    <div>
      <p>您正在阅读{bookArr.length}本书</p>
      {
        bookArr&&bookArr.length>0?bookArr.map((item,index)=>{
           return <ProductCard key={index}
           desc={item.desc}
           title={item.title}
           thumb={item.img}
         />
        }):"快加入书包吧"
      }
    </div>
  )
}

export default Index